#include<stdio.h>
#include<stdlib.h>
// 头插法实现单链表赋值

typedef struct Node
{
	int data;
	struct Node *next;
	
}Node;
int main(){

	int a[]={1,2,3,4,5,6,7,8,9};
	Node *p,*s;
	//C只是一个头结点是没有存值的C->data应该是初始化的0
	Node *C =(Node *)malloc(sizeof(Node));

	for(int i=0;i<9;i++){
		p =(Node*)malloc(sizeof(Node));
		p->data=a[i];

		p->next=C->next;
		C->next=p;

	}

	while(C->next!=NULL){
		C=C->next;
		printf("%d\n",C->data);

	}
	return 0;
}
